HTTP Action for SMS: User Guide
HTTP Action for SMS: User Guide
Overview
This guide will walk you through creating an HTTP action to send SMS messages using the Plivo API. We'll set up the action to accept recipient phone numbers and message content as inputs.
Setting Up the HTTP Action
Step 1: Create a New Action
- In your rule engine, create a new action and select "HTTP" as the action type.
[Image placeholder: Screenshot of action type selection with HTTP highlighted]
Step 2: Configure Inputs
- Set up two inputs for your action:
to
: The recipient's phone numbertext
: The content of the SMS message
[Image placeholder: Screenshot of input configuration]
Step 3: Configure HTTP Request
Fill in the HTTP request details:
Method: POST
URL:
https://api.plivo.com/v1/Account/{YOUR_PLIVO_ACCOUNT_ID}/Message/
Headers:
{
"Content-Type": "application/json"
}Body Type: JSON
Body:
{
"src": "{YOUR_PLIVO_PHONE_NUMBER}",
"dst": "{{inputs.to}}",
"text": "{{inputs.text}}"
}Basic Auth:
- Username:
{YOUR_PLIVO_AUTH_ID}
- Password:
{YOUR_PLIVO_AUTH_TOKEN}
- Username:
[Image placeholder: Screenshot of HTTP request configuration]
Step 4: Configure Backoff (Optional)
- If you want to implement retry logic, configure the Backoff settings:
- Initial Interval: 1 second
- Max Interval: 30 seconds
- Max Elapsed Time: 2 minutes
[Image placeholder: Screenshot of Backoff configuration]
Using the HTTP Action
In a Rule
- In your rule logic, add this HTTP action where you want to send an SMS.
- Map the
to
andtext
inputs:to
: Use the recipient's phone number (e.g., from device metadata or user input)text
: Construct your message (e.g., "Temperature alert: {{trigger.temperature}}°C")
[Image placeholder: Screenshot of action usage in a rule]
Best Practices
- Always validate phone numbers before sending.
- Use environment variables or secrets management for sensitive data like API keys.
- Include error handling in your rule to manage failed SMS sends.
Troubleshooting
- If SMS fails to send, check Plivo account balance and API credentials.
- Verify that the phone number format matches Plivo's requirements (e.g., including country code).
- Review Plivo API response for specific error messages.
[Video placeholder: Short tutorial on setting up and testing the HTTP action for SMS]
By following this guide, you can easily integrate SMS notifications into your rules, allowing for real-time alerts based on your IoT device data or other trigger conditions.